import Mock from 'mockjs'

const domain = '/api/'

// 模拟login接口
Mock.mock(domain + 'login', function () {
  let result = {
    code: 200,
    message: 'OK',
    data: {
      token: 'yyds2023',
    },
  }
  return result
})

Mock.mock(domain + 'getUserInfo', function () {
  let result = {
    code: 200,
    message: 'OK',
    data: {
      userId: 10000,
      nickName: '兔子先生',
    },
  }
  return result
})

Mock.mock(domain + 'getRouters', function () {
  let result = {
    code: 200,
    message: '返回数据成功',
    data: [
        {path: '/user', component: "user/index", hidden: false, meta: { title: '用户管理', noCache: false}},
        {path: '/role', component: "role/index", hidden: false, meta: { title: '角色管理', noCache: false}}
    ],
  }
  return result
})

Mock.mock(domain + 'getUserList', function () {
  let result = {
    code: 200,
    message: 'OK',
    data: [
      {
        key: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York No. 1 Lake Park',
        tags: ['nice', 'developer']
      },
      {
        key: '2',
        name: 'Jim Green',
        age: 42,
        address: 'London No. 1 Lake Park',
        tags: ['loser']
      },
      {
        key: '3',
        name: 'Joe Black',
        age: 32,
        address: 'Sydney No. 1 Lake Park',
        tags: ['cool', 'teacher']
      }
    ]
  }
  return result
})
